/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BL;

/**
 *
 * @author DarkIaspis
 */
public class ScalarProduct {
    
    public static double perform(double[] a, double b[]) throws WrongSizeException{
        if(a.length != b.length) throw new WrongSizeException(a.length, b.length);
        return SumVector.perform(productTwoVector(a, b));
    }
    
    private static double[] productTwoVector(double[] a, double[] b){
        double ret[] = new double[a.length];
        for(int i=0; i<a.length; i++) ret[i]=a[i]*b[i];
        return ret;
    }
    
}
